<!DOCTYPE html>
<title>Test media element readystate value on load.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    assert_equals(video.readyState, HTMLMediaElement.HAVE_NOTHING);
    video.onloadstart = t.step_func(function() {});
    video.onloadedmetadata = t.step_func(function() {});
    video.onloadeddata = t.step_func(function() {});
    video.oncanplay = t.step_func(function() {});
    video.onplay = t.unreached_func();
    video.onplaying = t.unreached_func();

    video.oncanplaythrough = t.step_func_done(function () {
        assert_equals(video.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA);
    });

    video.src = "content/test.ogv";
});
</script>